<template>
  <div class="wrapper">
    <swiper :options="swiperOption">
      <!-- slides -->
      <swiper-slide v-for="item in list" :key="item.id">
          <img :src="item.picUrl" class="swiper-img">
      </swiper-slide>
      <!-- Optional controls -->
      <div class="swiper-pagination"  slot="pagination"></div>
    </swiper>
    <loading class="loading" v-show="!list.length"></loading>
  </div>
</template>

<script>
import Loading from '@/components/loading/loading'
export default {
  name: 'RecommendSlider',
  data () {
    return {
      swiperOption: {
        pagination: '.swiper-pagination',
        loop: true,
        autoplay: {
          delay: 3000,
          stopOnLastSlide: false,
          disableOnInteraction: true
        }
      }
    }
  },
  props: {
    list: Array
  },
  components: {
    Loading
  }
}

</script>
<style lang='stylus' scoped>
.wrapper >>> .swiper-pagination-bullet-active
  background #fff
.wrapper
  padding-bottom 40%
  overflow hidden
  height 0
  .loading
    margin-top 20%
  .swiper-img
    width 100%
</style>
